<?php
namespace Home\Controller;
class CronController extends HomeController {
    public function minite(){
        // 删除超时未支付的幸运码
        $map_timeout = array(
            'status'    =>  0,
            'add_time'  =>  array('elt',NOW_TIME - C("pay_timeout"))
        );
        M('user_code')->where($map_timeout)->delete();
        // 查询活动设置活动开启
        $map_start = array(
            'status'    =>  0,
            'start_time'=>  array('elt',NOW_TIME)
        );
        M('snatch')->where($map)->setField('status',1);
        // 活动开奖
        $map_lottery = array(
            'status'    =>  1,
            'end_time'  =>  array('elt',NOW_TIME)
        );
        $list = M('snatch')->where($map_lottery)->select();
        if (!empty($list)) {
            foreach ($list as $key => $value) {
                snatch_lottery($value['id']);
            }
        }
        echo "ok";
        exit();
    }
}